<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Tk_SetClassProcs manual page - Tk Library Procedures</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tk C API</a> <small>&gt;</small> SetClassProcs</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<H3><A NAME="M2">NAME</A></H3>
Tk_SetClassProcs &mdash; register widget specific procedures
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tk.h&gt;</B><BR>
<B>Tk_SetClassProcs</B>(<I>tkwin, procs, instanceData</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL class="arguments">
<DT><A HREF="../TkLib/WindowId.htm">Tk_Window</A> <B>tkwin</B> (in)<DD>
Token for window to modify.
<P><DT>const Tk_ClassProcs <B>*procs</B> (in)<DD>
Pointer to data structure containing widget specific procedures.
The data structure pointed to by <I>procs</I> must be static:
Tk keeps a reference to it as long as the window exists.
<P><DT>ClientData <B>instanceData</B> (in)<DD>
Arbitrary one-word value to pass to widget callbacks.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
<B>Tk_SetClassProcs</B> is called to register a set of procedures that
are used as callbacks in different places.
<P>
The structure pointed to by <I>procs</I> contains the following:
<PRE>typedef struct Tk_ClassProcs {
    unsigned int <I>size</I>;
    Tk_ClassWorldChangedProc *<I>worldChangedProc</I>;
    Tk_ClassCreateProc *<I>createProc</I>;
    Tk_ClassModalProc *<I>modalProc</I>;
} <B>Tk_ClassProcs</B>;</PRE>
The <I>size</I> field is used to simplify future expansion of the
structure. It should always be set to (literally) <B>sizeof(Tk_ClassProcs)</B>.
<P>
<I>worldChangedProc</I> is invoked when the system has altered
in some way that requires some reaction from the widget.  For example,
when a font alias (see the <B><A HREF="../TkCmd/font.htm">font</A></B> manual entry) is reconfigured,
widgets configured to use that font alias must update their display
accordingly.  <I>worldChangedProc</I> should have arguments and results
that match the type <B>Tk_ClassWorldChangedProc</B>:
<PRE>typedef void <B>Tk_ClassWorldChangedProc</B>(
        ClientData <I>instanceData</I>);</PRE>
The <I>instanceData</I> parameter passed to the <I>worldChangedProc</I>
will be identical to the <I>instanceData</I> parameter passed to
<B>Tk_SetClassProcs</B>.
<P>
<I>createProc</I> is used to create platform-dependent windows.  It is
invoked by <B><A HREF="../TkLib/CrtWindow.htm">Tk_MakeWindowExist</A></B>.  <I>createProc</I> should have
arguments and results that match the type <B>Tk_ClassCreateProc</B>:
<PRE>typedef Window <B>Tk_ClassCreateProc</B>(
        <A HREF="../TkLib/WindowId.htm">Tk_Window</A> <I>tkwin</I>,
        Window <I>parent</I>,
        ClientData <I>instanceData</I>);</PRE>
The <I>tkwin</I> and <I>instanceData</I> parameters will be identical to
the <I>tkwin</I> and <I>instanceData</I> parameters passed to
<B>Tk_SetClassProcs</B>.  The <I>parent</I> parameter will be the parent
of the window to be created.  The <I>createProc</I> should return the
created window.
<P>
<I>modalProc</I> is invoked after all bindings on a widget have been
triggered in order to handle a modal loop.  <I>modalProc</I> should
have arguments and results that match the type <B>Tk_ClassModalProc</B>:
<PRE>typedef void <B>Tk_ClassModalProc</B>(
        <A HREF="../TkLib/WindowId.htm">Tk_Window</A> <I>tkwin</I>,
        XEvent *<I>eventPtr</I>);</PRE>
The <I>tkwin</I> parameter to <I>modalProc</I> will be identical to the
<I>tkwin</I> parameter passed to <B>Tk_SetClassProcs</B>.  The
<I>eventPtr</I> parameter will be a pointer to an XEvent structure
describing the event being processed.
<H3><A NAME="M6">KEYWORDS</A></H3>
<A href="../Keywords/C.htm#callback">callback</A>, <A href="../Keywords/C.htm#class">class</A>
<div class="copy">Copyright &copy; 2000 Ajuba Solutions.
</div>
</BODY></HTML>
